/*
 * ToolBarDelegate.h  0.4.0 / Dec 05, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#ifndef TOOLBARDELEGATE_H
#define TOOLBARDELEGATE_H

#include "Cute4jSwing.h"

#include "ContainerDelegate.h"

// ToolBarDelegate Class. ------------------------------------------------------

/*!
 * \brief ToolBar Delegate.
 *
 * \author Slobodan Vrkacevic
 * \version 0.4.0
 */
class CUTE4J_EXPORT ToolBarDelegate : public ContainerDelegate
{
  Q_OBJECT
protected:
  ToolBarDelegate(JNIEnv *env, jobject obj);
public slots: // native calls
  void setName(JNIEnv *env, jstring name);
  void insertChild(JNIEnv *env, jlong childDelegate, jint index);
  void removeChild(JNIEnv *env, jlong childDelegate);
  void setFloatable(JNIEnv *env, jboolean floatable);
  void setOrientation(JNIEnv *env, jint orientation);
  void setIconSize(JNIEnv *env, jint width, jint height);
public: // native calls
  static void initialize(JNIEnv *env, jclass cls);
  static jlong newInstance(JNIEnv *env, jobject obj);
public: // native callbacks
  void orientationChanged(jint orientation);
public:
  inline QToolBar *qToolBar() const;
protected slots:
  void orientationChangedSlot(Qt::Orientation orientation);
private:
  static jmethodID sm_orientationChangedMID;
};

// ToolBarDelegate :: Public Inline Member Function. ---------------------------

/*!
 * \brief Returns QToolBar adaptee.
 *
 * \return QToolBar adaptee
 */
inline QToolBar *ToolBarDelegate::qToolBar() const
{
  return static_cast<QToolBar *>(qObject());
}

// Macro Definition. -----------------------------------------------------------

#define TOOL_BAR_CAST(delegate) (reinterpret_cast<ToolBarDelegate *>(delegate))
#define TOOL_BAR_DELEGATE TOOL_BAR_CAST(delegate)

#endif // TOOLBARDELEGATE_H
